﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:AuthenticationService.Client.Controls" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d">
    <Style TargetType="local:LoginStatus">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:LoginStatus">
                    <Grid x:Name="corePart">
                		<VisualStateManager.VisualStateGroups>
                			<VisualStateGroup x:Name="LoginStatusStates">
                				<VisualStateGroup.Transitions>
                					<VisualTransition From="LoggedIn" GeneratedDuration="00:00:00.5000000" To="LoggedOut">
                						<Storyboard>
                							<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="LoginContainer" Storyboard.TargetProperty="(UIElement.Visibility)">
                								<DiscreteObjectKeyFrame KeyTime="00:00:00">
                									<DiscreteObjectKeyFrame.Value>
                										<Visibility>Visible</Visibility>
                									</DiscreteObjectKeyFrame.Value>
                								</DiscreteObjectKeyFrame>
                							</ObjectAnimationUsingKeyFrames>
                							<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="LoggedInContainer" Storyboard.TargetProperty="(UIElement.Visibility)">
                								<DiscreteObjectKeyFrame KeyTime="00:00:00">
                									<DiscreteObjectKeyFrame.Value>
                										<Visibility>Collapsed</Visibility>
                									</DiscreteObjectKeyFrame.Value>
                								</DiscreteObjectKeyFrame>
                							</ObjectAnimationUsingKeyFrames>
                						</Storyboard>
                					</VisualTransition>
                					<VisualTransition From="LoggedOut" GeneratedDuration="00:00:00" To="LoggedIn">
                						<Storyboard>
                							<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="LoginContainer" Storyboard.TargetProperty="(UIElement.Visibility)">
                								<DiscreteObjectKeyFrame KeyTime="00:00:00">
                									<DiscreteObjectKeyFrame.Value>
                										<Visibility>Collapsed</Visibility>
                									</DiscreteObjectKeyFrame.Value>
                								</DiscreteObjectKeyFrame>
                							</ObjectAnimationUsingKeyFrames>
                							<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="LoggedInContainer" Storyboard.TargetProperty="(UIElement.Visibility)">
                								<DiscreteObjectKeyFrame KeyTime="00:00:00">
                									<DiscreteObjectKeyFrame.Value>
                										<Visibility>Visible</Visibility>
                									</DiscreteObjectKeyFrame.Value>
                								</DiscreteObjectKeyFrame>
                							</ObjectAnimationUsingKeyFrames>
                						</Storyboard>
                					</VisualTransition>
                				</VisualStateGroup.Transitions>
                				<VisualState x:Name="LoggedOut"/>
                				<VisualState x:Name="LoggedIn">
                					<Storyboard>
                						<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="LoggedInContainer" Storyboard.TargetProperty="(UIElement.Visibility)">
                							<DiscreteObjectKeyFrame KeyTime="00:00:00">
                								<DiscreteObjectKeyFrame.Value>
                									<Visibility>Visible</Visibility>
                								</DiscreteObjectKeyFrame.Value>
                							</DiscreteObjectKeyFrame>
                						</ObjectAnimationUsingKeyFrames>
                						<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="LoginContainer" Storyboard.TargetProperty="(UIElement.Visibility)">
                							<DiscreteObjectKeyFrame KeyTime="00:00:00">
                								<DiscreteObjectKeyFrame.Value>
                									<Visibility>Collapsed</Visibility>
                								</DiscreteObjectKeyFrame.Value>
                							</DiscreteObjectKeyFrame>
                						</ObjectAnimationUsingKeyFrames>
                					</Storyboard>
                				</VisualState>
                			</VisualStateGroup>
                		</VisualStateManager.VisualStateGroups>
                		<StackPanel x:Name="LoginContainer" HorizontalAlignment="Right" Orientation="Horizontal">
                    		<!--<Button Margin="0" Content="Login" Style="{StaticResource LinkButtonStyle}" Background="{x:Null}" BorderBrush="{x:Null}"/>-->
                    		<HyperlinkButton x:Name="LoginButton" Content="Login" Background="{x:Null}" Height="16" Width="34"/>
                    	</StackPanel>
                    	<StackPanel x:Name="LoggedInContainer" Orientation="Horizontal" HorizontalAlignment="Right" Visibility="Collapsed">
                    		<TextBlock x:Name="WelcomeText" Text="Welcome back,"/>
                    		<HyperlinkButton x:Name="ProfileButton" Content="{TemplateBinding Username}" Background="{x:Null}" Height="16" Width="60"/>
                    		<HyperlinkButton x:Name="LogoutButton" Content="Logout" Background="{x:Null}" Height="16" Width="42"/>
                    	</StackPanel>
                	</Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
